############################################
# Makefile per i test delle funzioni in intervals.h ilist.h
############################################
# Specifica dove cercare i file di include nelle makerule
vpath %.h ./../../Src

# Header file for cunit
INC = -I /usr/local/include/CUnit/ -I ../../Src  -I /usr/include/CUnit/

# Compiler flags
CFLAGS = -Wall -pedantic -g
#CFLAGS = -O3 -Wuninitialized

# Compiler
CC = gcc

# libreria da testare
LIB_PATH = -L ../../lib/

.PHONY : test clean

interval_test: interval_test.o interval_suite.o
	$(CC)  $(LIB_PATH) -o interval_test $^ -lcunit -lztl

interval_test.o:  interval_test.c  interval_suite.h
	$(CC) $(CFLAGS) $(INC) -c $<

interval_suite.o: interval_suite.c  intervals.h 
	$(CC) $(CFLAGS) $(INC) -c $<

# Target di testing
test: interval_test
	echo MALLOC_TRACE e\' $(MALLOC_TRACE)
	@echo MALLOC_TRACE deve essere settata a \"./.mtrace\"
	-rm -f ./.mtrace
	./interval_test
	mtrace ./interval_test ./.mtrace
	@echo -e "\n\n\a *** Test interval superato! ***\n"	


clean:
	rm -f *.o
	rm -f interval_test .mtrace
	rm -f *~